package com.dreamwhale.machinery.controller;


import com.dreamwhale.machinery.config.DataResult;
import com.dreamwhale.machinery.service.VipUserInfoService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Author
 * @since 2020-07-08
 */
@RestController
@RequestMapping("/vipUserInfo")
public class VipUserInfoController {

    @Resource
    private VipUserInfoService vipUserInfoService;

    @RequestMapping("buyVip")
    /**
     * @MethodName : buyVip
     * @Description : 购买VIP
     * @param : vipId  vipId
     * @param : payType 支付类型
     * @param : request
     * @Author : DragonUncle
     * @Data : 9:51 2020/7/9
     * @return :
     */
    public DataResult buyVip(Integer vipId, Integer payType, HttpServletRequest request) {
        Integer userId = Integer.parseInt(request.getAttribute("userId").toString());
        System.out.println(userId);
        return vipUserInfoService.buyVip(vipId, payType, userId);
    }
}

